import json

from api.base_service_api import BaseService


class OrderSettingService(BaseService):
    def __init__(self):
        super().__init__()
    def add(self,order_data):
        resp=self.dubbo_client.invoke("OrderSettingService","add",order_data)
        if resp=="null":
            return True
        else:
            return False

    def get_order_setting_by_month(self,month):
        """"
        根据月份，查询预约信息
        param month:月份，字符串 示例
        return：
        """
        resp=self.dubbo_client.invoke("OrderSettingService","getOrderSettingByMonth",month)
        json.loads(resp)
    def edit_number_by_date(self,number_data):
        """"
        根据日期修改预约信息
        """
        resp=self.dubbo_client.invoke("OrderSettingService","editNumberByDate",number_data)
        if resp == "null":
            return True
        else:
            return False










if __name__ == '__main__':
    oos=OrderSettingService()
    order_data=[{"orderDate": "2021-09-02 01:01:01", "number": 101}]
    result=oos.add(order_data)
    print(result)
    print(type(result))
    month="2022-04"
    resp=oos.get_order_setting_by_month(month)
    print(resp)